home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compendium Deluxe 2
/
LSD and 17bit Compendium Deluxe - Volume II.iso
/
a
/
prog
/
asmsrc
/
fonttest.lha
/
SOURCE
/
FontTest.S
Wrap
Text File
|
1980-12-27
|
5KB
|
220 lines
section TestFont,code_c
OpenLibrary equ -552 ; _LVO values
CloseLibrary equ -414
AllocRaster equ -492
FreeRaster equ -498
CUSTOM equ $dff000
VHPOSR equ $006 ; Hardware stuff
BPL1PTH equ $0E0
BPL1PTL equ $0E2
BPL2PTH equ $0E4
BPL2PTL equ $0E6
BPL3PTH equ $0E8
BPL3PTL equ $0EA
BPL1MOD equ $108
BPL2MOD equ $10A
BPLCON0 equ $100
BPLCON1 equ $102
BLTAPTH equ $050
BLTDPTH equ $054
BLTAFWM equ $044
BLTALWM equ $046
BLTCON0 equ $040
BLTCON1 equ $042
BLTAMOD equ $064
BLTDMOD equ $066
BLTSIZE equ $058
COLOR00 equ $180
COLOR01 equ $182
COLOR02 equ $184
COLOR03 equ $186
COLOR04 equ $188
COLOR05 equ $18A
COLOR06 equ $18C
COLOR07 equ $18E
DIWSTRT equ $08E
DIWSTOP equ $090
DDFSTRT equ $092
DDFSTOP equ $094
DMACON equ $096
DMACONR equ $002
PLANESIZE equ 44*200
move.l $4.w,a6 Open graphics library
move.l #GfxName,a1
moveq #0,d0
jsr OpenLibrary(a6)
tst.l d0
beq Error
move.l d0,GfxBase (save base pointer)
move.l GfxBase,a6 Now grab some screen
move.l #352,d0 memory for 3 planes
move.l #(200*3),d1
jsr AllocRaster(a6)
move.l d0,ScreenMem
beq Error
move.l #BPL1,a0 Put bitplane addresses in
moveq #2,d1 copper list
CprLoop move.w d0,6(a0)
swap d0
move.w d0,2(a0)
swap d0
addi.l #PLANESIZE,d0
lea 8(a0),a0
dbf d1,CprLoop
move.l ScreenMem,a0 Clear the screen
moveq #0,d0
move.w #(3*352/8*200/4-1),d0
ClrLoop clr.l (a0)+
dbra d0,ClrLoop
move.l #Font,a0 Add some colour
move.w (a0)+,c00
move.w (a0)+,c01
move.w (a0)+,c02
move.w (a0)+,c03
move.w (a0)+,c04
move.w (a0)+,c05
move.w (a0)+,c06
move.w (a0)+,c07
move.l GfxBase,a0
move.l $32(a0),CopperSave Save old copper list...
move.l #CopperList,$32(a0) ...and put in ours
Loop:
cmp.b #$FF,VHPOSR+CUSTOM Wait for vertical blank
bne.s Loop
bsr Scrolly
andi.b #$40,$bfe001 Test left mouse button
bne Loop - if down, exit...
move.l GfxBase,a6 Restore the old screen
move.l CopperSave,$32(a6)
move.l GfxBase,a6 Give back screen memory
move.l ScreenMem,a0
move.l #352,d0
move.l #3*200,d1
jsr FreeRaster(a6)
move.l $4.w,a6
move.l GfxBase,a1
jsr CloseLibrary(a6) Close gfx library
moveq #0,d0
Error: ;Bye bye!
rts
Scrolly: ;The scrolling message
addi.w #1,Count A new letter every 10 frames
cmpi.w #10,Count Draw one ?
bne DoScroll No - Just do scroll
clr.w Count
move.l Letter,a0
tst.b (a0) End of message ?
bne.s CharOK Skip if not
move.l #Message,a0 Reset pointer
CharOK:
moveq #0,d0
move.b (a0)+,d0 Get next letter
move.l a0,Letter Save pointer
sub.b #" ",d0 Get letter in font range
mulu #32*2*2*3,d0 1 char=3*128 bytes
move.l #Font,a0
add.l d0,a0 Get offset in font table
add.l #16,a0 Skip past colour info
bsr PlotChar
DoScroll:
bsr WaitBlit
move.l ScreenMem,d0 Plane 1
bsr.s Scroll
bsr WaitBlit
move.l ScreenMem,d0
addi.l #PLANESIZE,d0 Plane 2
bsr.s Scroll
bsr WaitBlit
move.l ScreenMem,d0
addi.l #PLANESIZE*2,d0 Plane 3
bsr.s Scroll
rts
Scroll: ; Blit scroll
lea CUSTOM,a2
addi.l #140*44+42,d0
move.w #$49f0,BLTCON0(a2) 4 pixels,use A & D,LF=copy
move.w #$0002,BLTCON1(a2) Descending mode
move.l d0,BLTAPTH(a2) Store scroll start
move.l d0,BLTDPTH(a2)
move.w #0,BLTAMOD(a2) No modulo
move.w #0,BLTDMOD(a2)
move.w #$ffff,BLTAFWM(a2) All the bits on the left
move.w #$fff0,BLTALWM(a2) Mask 1st 4 bits on right
bsr.s WaitBlit Patience!
move.w #$c16,BLTSIZE(a2) Do blit
rts
WaitBlit: ; Wait for blitter to finish
btst.b #6,DMACONR+CUSTOM
.loop
btst.b #6,DMACONR+CUSTOM
bne .loop
rts
PlotChar
moveq #0,d1
CLoop move.l ScreenMem,a1
move.w #PLANESIZE,d2
mulu d1,d2
addi.l #(105*44+40),d2 Calculate start address
add.l d2,a1
moveq #31,d0 32 lines
Plot move.l (a0)+,(a1) Copy data
lea 44(a1),a1
dbf d0,Plot
addq #1,d1 Next plane
cmpi #3,d1 All done?
bne.s CLoop
rts
ScreenMem
dc.l 0
GfxName:
dc.b "graphics.library",0
even
GfxBase:
dc.l 0
CopperSave:
dc.l 0
CopperList:
BPL1 dc.w BPL1PTH,$0000
dc.w BPL1PTL,$0000
BPL2 dc.w BPL2PTH,$0000
dc.w BPL2PTL,$0000
BPL3 dc.w BPL3PTH,$0000
dc.w BPL3PTL,$0000
dc.w BPLCON0,$3200
dc.w BPLCON1,$0000
dc.w BPL1MOD,$0004
dc.w BPL2MOD,$0004
dc.w DDFSTRT,$0038
dc.w DDFSTOP,$00D0
dc.w DIWSTRT,$2C81
dc.w DIWSTOP,$F4C1
dc.w COLOR00
c00 dc.w 0
dc.w COLOR01
c01 dc.w 0
dc.w COLOR02
c02 dc.w 0
dc.w COLOR03
c03 dc.w 0
dc.w COLOR04
c04 dc.w 0
dc.w COLOR05
c05 dc.w 0
dc.w COLOR06
c06 dc.w 0
dc.w COLOR07
c07 dc.w 0
dc.w $ffff,$fffe ; End of copper list
Letter dc.l Message
Count dc.w 0
Message dc.b "!$%&*()-+=\/.,><;:@#0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",0
even
Font:
; v-------Put your own module name in here
incbin "df1:myfont.mod"